// base
import Taro, { Component } from '@tarojs/taro'
import { View, Text, Image } from '@tarojs/components'
// less
import './index.less'

class IntentionCard extends Component {
  componentWillMount() {
    // onLoad
  }

  componentDidMount() {
    // onready
  }

  componentWillUnmount() {
    // onUnload
  }

  componentWillReceiveProps(nextprops) {}

  onClick = () => {
    const { wantWorkId, index } = this.props
    this.props.onTap(1, wantWorkId, index)
  }

  render() {
    const { workNature = [], workPlace = [], comprehensive = {}, jobPlace = '' } = this.props
    return (
      <View className="IntentionCard_id20447" onClick={this.onClick}>
        <View className="title-view">
          <View className="title">{workNature}</View>
          {workNature == '兼职' ? (
            <Image
              className="card-left-img"
              src="https://imagesize.hrwork.com/sp/files/f0f92fd2-5c5f-4702-88af-2c4bed62db22.png"
            />
          ) : workNature == '全职' ? (
            <Image
              className="card-left-img"
              src="https://imagesize.hrwork.com/sp/files/6b18b1a7-0b04-4cea-85a3-0beb34cc0a89.png"
            />
          ) : (
            <Image
              className="card-left-img"
              src="https://imagesize.hrwork.com/sp/files/6e26440e-b574-4830-be44-05a487fffe4d.png"
            />
          )}
          <View className="area">
            {jobPlace || ''} {workPlace.join(' ')}
          </View>
        </View>
        <View className="tips">
          {(comprehensive.workCategory ? comprehensive.workCategory : [])
            .filter(e => e)
            .map(e => (
              <View className="tips-item" key={e}>
                {e}
              </View>
            ))}
        </View>
      </View>
    )
  }
}

export default IntentionCard
